using UnityEngine;
using Exoa.Cameras.Demos;
using UnityEngine.UI;
[RequireComponent(typeof(FocusOnClick))]
public class BiaoQianCreat : MonoBehaviour
{
    //public TooltipObject 标签;
    public GameObject 标签;
    public string ParentName = "标签组";
    private void Start()
    {
        GameObject parent = GameObject.Find(ParentName);
        if (parent == null)
        {
            Debug.LogError("名称为" + ParentName + "的物体不存在");
            return;
        }
        GameObject bq = GameObject.Instantiate(标签, parent.transform);
        标签 = bq;
        bq.GetComponent<TooltipObject>().Follow(this.GetComponent<FocusOnClick>());
        Button btn;
        btn = bq.GetComponent<Button>();
        if (btn == null)
            btn = bq.GetComponentInChildren<Button>();
        btn.onClick.AddListener(() => {
            this.GetComponent<FocusOnClick>().Jvjiao();
            OnClickFunc();
        });
        OnCreat();
    }
    /// <summary>
    /// 标签被点击函数
    /// </summary>
    public virtual void OnClickFunc()
    {

    }
    /// <summary>
    /// 标签创建后的函数
    /// </summary>
    public virtual void OnCreat()
    {

    }
}
